﻿(function(){
	if(!Mui){
		return;
	}
	
	Mui.ready(function(Mui){
		Mui.use('mammoo.form',function(Mui){
			var f=new Mammoo.form({
				action:'/service/member.ashx',
				op:'register',
				id:'mo_register',
				validate:[{
					name:'Member_Username',
					rules:{
						required:true,
						rangelength:[6,10],
						ajax:{
							url:'/service/member.ashx?op=validate',
							check:function(r){
								return !r.data;
							}
						}
					},
					message:{
						required:'请输入用户名',
						rangelength:'用户名介于{0}-{1}位'
					}
				},{
					name:'Member_Password',
					rules:{
						required:true,
						rangelength:[6,10]
					},
					message:{
						required:'请输入密码',
						rangelength:'用户名介于{0}-{1}位'
					}
				},{
					name:'repassword',
					rules:{
						required:true,
						equalTo:'#mo_password'
					},
					message:{
						required:'请再次输入密码',
						equal:'两次输入的密码不相同'
					}
				},{
					name:'Member_Email',					
					rules:{
						required:true,
						email:true
					},
					message:{
						required:'请输入邮箱',
						email:'请输入正确格式的邮箱'
					}
				}],
				inModel:true,
				getModel:function(model){
					delete model.repassword;
				},
				success:function(result){
					Mui.tip.tips(result.msg);
				},
				fail:function(result){
					Mui.tip.tips(result.msg);
				}
			});
		});
	});
})();